package com.irdstudio.efp.riskm.service.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.irdstudio.efp.riskm.service.domain.RscResultDetail;
import com.irdstudio.efp.riskm.service.vo.RscResultDetailVO;
/**
 * <p>DAO interface:风险分类结果明细表				<p>
 * @author chenqm1
 * @date 2018-05-07
 */
public interface RscResultDetailDao {
	
	public int insertRscResultDetail(RscResultDetail rscResultDetail);
	
	public int deleteByPk(RscResultDetail rscResultDetail);
	
	public int updateByPk(RscResultDetail rscResultDetail);
	
	public RscResultDetail queryByPk(RscResultDetail rscResultDetail);
	
	public List<RscResultDetail> queryAllOwnerByPage(RscResultDetailVO rscResultDetail);
	
	public List<RscResultDetail> queryAllCurrOrgByPage(RscResultDetailVO rscResultDetail);
	
	public List<RscResultDetail> queryAllCurrDownOrgByPage(RscResultDetailVO rscResultDetail);

	public RscResultDetail queryByManual(RscResultDetail rscResultInfo);

	public RscResultDetail queryBySystem(RscResultDetail rscResultInfo);

	public RscResultDetail queryFirstByClaDate(RscResultDetail queryRscResultDetail);

	public void updateByBillNo(RscResultDetail resultDetail);
	
	public int insertBatchRscResultDetail(@Param(value="rscResultDetails") List<RscResultDetail> rscResultDetailList);

	public void deleteBydaybatDate(@Param("startRunDate") String startRunDate);
	
	/**
	 * 获取客户人工分类最高的等级
	 * @param cusIds
	 * @return
	 */
	public List<RscResultDetail> queryMaxManualResultByCusIds(@Param("assureMeansMain") String assureMeansMain, @Param("cusIds") List<String> cusIds);
	
	/**
	 * 获取客户系统分类最高的等级
	 * @param assureMeansMain
	 * @param cusIds
	 * @return
	 */
	public List<RscResultDetail> queryMaxSystemResultByCusIds(@Param("assureMeansMain") String assureMeansMain, @Param("cusIds") List<String> cusIds);
	
	/**
	 * 将前一天的分类明细移到历史表，人工分类未解除前不转移
	 * @param openday
	 * @return
	 */
	public int insertDetailHisFromDetailByLastOpenday(@Param("lastOpenday") String lastOpenday);
	
	/**
	 * 删掉转移到历史表的数据
	 * @param lastOpenday
	 * @return
	 */
	public int deleteDetailWhenMoveToDetailHis(@Param("lastOpenday") String lastOpenday);
	
	/**
	 * 查询不存在分类台账的借据号
	 * @return
	 */
	public List<String> queryBillNoNotExistsRscTaskLoan();

}
